#pragma once
#include "sensordatainput.h"
#include "ReconstructByKinectCommonGlobal.h"
#include <fstream>



class _LIB_CLASS SensorDataFileInput : public SensorDataInput
{
private:

	std::ifstream _inStream;
	char *_buf;
	char *_frontBuf;
	char *_backBuf;
	bool _hasNewFrame;
	int _frameDataSize;
	HANDLE _frontBufReady;
	HANDLE _frontBufRead;
	HANDLE _thread;

	virtual bool _grabFrame ();

public:

	SensorDataFileInput (const std::string &name, char* dataFile,
			const std::string &intrinsicFile = "../Data/Calibration/default.dat");

	virtual ~SensorDataFileInput ();

	void backThreadMain ();

};

unsigned int WINAPI readFrameThreadEntry (void * lpParam);